<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <input type="text" id="num1" />
        <select name="" id="operationList">
            <option value="1">+</option>
            <option value="2">-</option>
            <option value="3">*</option>
            <option value="4">/</option>
        </select>
        <input type="text" id="num2" />
        <button id="bt">=</button>
        <input type="text" id="num3" disabled />
        <script>
            bt.onclick = function () {
                let a = Number(num1.value);
                let b = Number(num2.value);
                let res = 0;
                let operation = Number(operationList.value);
                switch (operation) {
                    case 1:
                        res = a + b;
                        break;
                    case 2:
                        res = a - b;
                        break;
                    case 3:
                        res = a * b;
                        break;
                    case 4:
                        res = a / b;
                        break;
                    default:
                        document.write("error");
                }
                num3.value = res;
                console.log(num3.value);
            };

            function getDay(y, m, d) {
                let res = 0;
                for (let i = 1; i <= m; i++) {
                    if (i === 1) {
                        res = d;
                    } else if (i === 3) {
                        if ((y % 4 === 0 && y % 100 !== 0) || y % 400 === 0) {
                            res += 29;
                        } else {
                            res += 28;
                        }
                    } else if (i === 5 || i === 7 || i === 10 || i === 12) {
                        res += 30;
                    } else {
                        res += 31;
                    }
                }
                console.log(res);
            }
            getDay(2022, 12, 10);
        </script>
    </body>
</html>
